<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
<script type="text/javascript" src="JS/jquery-2.1.1.js"></script>
<script type="text/javascript" src="JS/jquery-form.js"></script>

<script type="text/javascript">
	function send() {

		//获取文件的路径
		var filepath = document.getElementById("file1").value;

		$("#myfile").ajaxSubmit({
			type : 'POST', //请求方式
			url : 'http://localhost:8080/Test/upload.do?path=' + filepath,//请求路径
			success : function(data) {//请求成功
				alert("上传成功");

			},
			error : function(XmlHttpRequest, textStatus, errorThrown) {//请求失败
				alert("上传失败");
			}
		});

	}
</script>

</head>
<body>

	<form enctype="multipart/form-data" method="POST" id="myfile">
		<input type="file" name="file" id="file1" />
	</form>
	<input type="button" onclick="send()" name="button" value="提交">
</body>
</html>